<?php 
session_start();
include_once '../config.php';
$usrID=intval($_SESSION['usrID']);
$channelID=intval($_GET['channelID']);
$pdo->exec("insert into online set usrID=$usrID,channelID=$channelID,status=1,time=unix_timestamp() on duplicate key update channelID=$channelID,status=1,time=unix_timestamp()");
?>
<article>
<?php
foreach($pdo->query("select u.fname,u.lname,u.usrID,(select f.freq from pchatfreq f where f.usrID=$usrID and f.recID=u.usrID) as freq from (usr u join online o on o.usrID) where o.usrID=u.usrID and o.channelID=$channelID and u.usrID != $usrID and (unix_timestamp()-o.time) <=10 order by freq desc") as $fetch){
?>
<a href='javascript:void(0)' id='<?="{$fetch['usrID']}_recID";?>' onclick="window.parent.chatBoxDialog('<?=$fetch['fname']." ".$fetch['lname'];?>',<?=$fetch['usrID'];?>)">
<table>
<tbody>
<tr><td><i class="icon-user icon-2x icon-border"></i></td><td><i class='icon-remove-sign'></i>&nbsp;&nbsp;<?=$fetch['fname']." ".$fetch['lname'];?></td></tr>
</tbody>
</table>
</a>
<?php
}
?>
</article>